<!doctype html>
<html class="no-js fixed-layout">
<head>
  <#include "head.ftl">
</head>
<body>
<#include "header.ftl">


<#include "menu.ftl">

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding">
        <ol class="am-breadcrumb">
		  <li><a href="${info.domain}" class="am-icon-home">首页</a></li>
		  <li><a href="${info.domain}ml">模型</a></li>
		  <li class="am-active">列表</li>
		</ol>
      </div>

     <div class="am-g">
        <div class="am-u-sm-12 am-u-md-6">
          <div class="am-btn-toolbar">
            <div class="am-btn-group am-btn-group-xs">
              <button type="button" class="am-btn am-btn-default am-btn-primary"><span class="am-icon-plus"></span> 新增</button>
              <button type="button" class="am-btn am-btn-default am-btn-primary"><span class="am-icon-save"></span> 保存</button>
              <button type="button" class="am-btn am-btn-default am-btn-primary"><span class="am-icon-archive"></span> 审核</button>
              <button type="button" class="am-btn am-btn-default am-btn-primary"><span class="am-icon-trash-o"></span> 删除</button>
            </div>
          </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
          <div class="am-form-group">
            
          </div>
        </div>
        <div class="am-u-sm-12 am-u-md-3">
          <div class="am-input-group am-input-group-sm">
            <input type="text" class="am-form-field">
          <span class="am-input-group-btn">
            <button class="am-btn am-btn-primary" type="button">搜索</button>
          </span>
          </div>
        </div>
      </div>

 <div class="am-g">
        <div class="am-u-sm-12">
          <table class="am-table am-table-bd am-table-striped admin-content-table">
            <thead>
            <tr>
              <th  style="width:50px;"></th>
              <th>ID</th><th>对应的KEY</th><th>是否为空</th><th>数据长度</th><th>关键词</th><th>过滤词</th><th>类型</th><th>练习次数</th><th>管理</th>
            </tr>
            </thead>
            <tbody>
            
            <#list page.list as item>
            <tr>
             <td>
            <label class="am-checkbox">
  			<input type="checkbox" value="${item.id}" data-am-ucheck>
			</label>
            </td>
            <td>${item.id}</td>
            <td>${item.keyword}</td>
            <td>
             <label class="am-switch">
    		<input type="checkbox" <#if item.isnull==1>checked</#if>  disabled>
    		<span class="am-switch-checkbox"></span>
			</label>
            </td>
            <td>${item.minlength}/${item.maxlength}</td>
            <td>${item.minword}</td>
             <td>${item.filterword}</td>
              <td>${types[item.type]}</td>
              <td>${item.count}</td>
              <td>
                <div class="am-dropdown" data-am-dropdown>
                  <button class="am-btn am-btn-default am-btn-xs am-dropdown-toggle" data-am-dropdown-toggle><span class="am-icon-cog"></span> <span class="am-icon-caret-down"></span></button>
                  <ul class="am-dropdown-content">
                   
                    <li><a href="javascript:update(${item.id});">编辑</a></li>
                   
                  </ul>
                </div>
              </td>
            </tr>
            </#list>
            </tbody>
          </table>
        </div>
        <#include "page.ftl">
      </div>


    </div>




 <#include "footer.ftl">
<script type="text/javascript">


 $('.am-table tr').on('click',function(){
   		
	   if($(this).find(".am-checkbox input[type=checkbox]").is(':checked'))
	   {	   	 
	   	  $(this).find(".am-checkbox input[type=checkbox]").uCheck('uncheck');
	   	  $('.am-table tr').removeClass("am-active");
	   	   $(".am-btn-tngou").addClass("am-disabled");
	   }else
	   {
	     $('.am-checkbox input[type=checkbox]').uCheck('uncheck');
	     $('.am-table tr').removeClass("am-active");
	     $(this).find(".am-checkbox input[type=checkbox]").uCheck('check');
	     $(this).addClass("am-active"); 
	      $(".am-btn-tngou").removeClass("am-disabled");
	   }

  	});
  	
  	
function dialogSelect(){
  	   AMUI.dialog.alert({
			    title: '提示',
			    content: '请选择数据'
			});
  	}
 
 function update(id)
  	{
  	 if(!id)id=$('.am-checkbox input[type=checkbox]:checked').val();
  	  if(id)
  	  {
  	  	window.location.href='${info.domain}ml/update/'+id;
  	  }else
  	  {
  	  	dialogSelect();
  	  }
  	
}  	

</script>

</body>
</html>
